package com.sh.caryr.erp.service.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sh.caryr.erp.entity.basis.Shop;
import com.sh.caryr.erp.mapper.ShopMapper;
import com.sh.caryr.erp.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 店铺表 服务实现类
 * </p>
 *
 * @author milkeeper
 * @since 2017-11-22
 */
@Service
public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IShopService {
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public List<Shop> findShopsDynamic(Integer current, Integer size, Wrapper wrapper, String orderBy) {
        return this.findShopsDynamic(new Page<Shop>(current, size), wrapper.orderBy(orderBy));
    }

    private List<Shop> findShopsDynamic(Page<Shop> page, Wrapper<Shop> wrapper) {
        List<Shop> shops = shopMapper.selectPage(page, wrapper);
        return shops;
    }
}
